home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d16 / oriel.arc / FEATURES.ORL < prev    next >
Text File  |  1991-07-31  |  12KB  |  421 lines

  1. {-----------------------------FEATURES.ORL------------------------------
  2. This program displays many of Oriel's features using simple routines.
  3. For example, there's a routine to move a bitmap across the screen and
  4. another to display different types of message boxes.
  5. -----------------------------------------------------------------------}
  6. {Set variable}
  7.     Set Delay = 2000
  8.  
  9. {Maximize the window and set the caption}
  10.     SetWindow(MAXIMIZE)
  11.     UseCaption("Oriel Features")
  12.  
  13. {Set up the window text}
  14. Set_Text:
  15.     UseBackground(TRANSPARENT,255,255,128)
  16.     DrawBackground
  17.     UseFont("Roman",0,20,BOLD,NOITALIC,NOUNDERLINE,64,0,0)
  18.     DrawText(76,5,"Oriel")
  19.     UseFont("Roman",0,20,BOLD,NOITALIC,NOUNDERLINE,255,0,0)
  20.     DrawText(75,5,"Oriel")
  21.     DrawBitmap(115,7,"ORIELIC3.BMP")
  22.     UseFont("Tms Rmn",0,10,BOLD,NOITALIC,NOUNDERLINE,0,0,0)
  23.     DrawText(35,30,"The Graphics-Based Batch Language")
  24.     DrawText(92,45,"for")
  25.     DrawText(60,60,"Microsoft Windows 3.0")
  26.     UseFont("Tms Rmn",0,12,BOLD,NOITALIC,NOUNDERLINE,0,0,255)
  27.     DrawText(55,80,"Select a Menu Option")
  28.     DrawText(35,95,"to Explore the Power of Oriel!")
  29.  
  30. {Set up the menu}
  31. Menu:
  32.     Gosub Menu_Init      {Establish default environment}
  33.     SetMenu("&Features",IGNORE,
  34.           "&Bitmaps",Bitmap,
  35.           "&Color, Brush, Font",Shape,
  36.           "&Flood an Area",Flood_Area,
  37.           "&Keyboard/Mouse Control",Mouse_Control,
  38.           "&Messages",Msg,
  39.           "&Read Mouse Coordinates",Read_Mouse,
  40.           "&Animation",Animate,
  41.           ENDPOPUP,
  42.         "&Exit!",Bye,
  43.           ENDPOPUP)
  44.  
  45. Wait_for_Input:
  46.     WaitInput()
  47.  
  48. {Bitmaps}
  49. Bitmap:
  50.     SetMenu()        {Reset the menu}
  51.     UseBackground(TRANSPARENT,0,255,128)
  52.     DrawBackground
  53.     UseFont("Roman",0,20,BOLD,NOITALIC,NOUNDERLINE,64,0,0)
  54.     DrawText(76,5,"Oriel")
  55.     UseFont("Roman",0,20,BOLD,NOITALIC,NOUNDERLINE,255,0,0)
  56.     DrawText(75,5,"Oriel")
  57.     DrawBitmap(115,9,"ORIELIC4.BMP")
  58.     UseFont("Tms Rmn",0,12,BOLD,NOITALIC,NOUNDERLINE,0,0,0)
  59.     UseBackground(TRANSPARENT,0,255,128)
  60.     DrawText(30,30,"allows you to load and size")
  61.     DrawText(30,40,"Windows bitmap (.BMP) files,")
  62.     DrawText(30,50,"like this Oriel bitmap...")
  63.     DrawBitmap(1,90,"ORIELIC4.BMP")
  64.     WaitInput(Delay)
  65.     Set DrawFactor = 20
  66.     Set DrawCol = 10
  67.     Set DrawEndCol = DrawCol + DrawFactor
  68.     Set DrawRow = 85
  69.     Set DrawEndRow = DrawRow + DrawFactor
  70.  
  71. Size_It:
  72.     DrawSizedBitmap(DrawCol,DrawRow,DrawEndCol,DrawEndRow,
  73.             "ORIELIC4.BMP")
  74.     WaitInput(Delay)
  75.     Set DrawFactor = DrawFactor + 10
  76.     Set DrawRow = DrawRow - 5
  77.     Set DrawCol = DrawEndCol
  78.     Set DrawEndCol = DrawCol + DrawFactor
  79.     Set DrawEndRow = DrawRow + DrawFactor
  80.     If DrawFactor > 60 Then Goto End_Draw
  81.     Goto Size_It
  82.  
  83. End_Draw:
  84.     SetKeyboard("C",Set_Text,
  85.                 "c",Set_Text,
  86.             13,Set_Text)
  87.  
  88.     UsePen(SOLID,1,0,0,0)
  89.     DrawRoundRectangle(80,125,120,140,2,2)
  90.     SetMouse(80,125,120,140,Set_Text,TEMP,TEMP)
  91.  
  92.     UseFont("SYSTEM",0,0,NOBOLD,NOITALIC,UNDERLINE,0,0,0)
  93.     DrawText(89,130,"C")
  94.     UseFont("SYSTEM",0,0,NOBOLD,NOITALIC,NOUNDERLINE,0,0,0)
  95.     DrawText(92,130,"ontinue")
  96.     WaitInput()
  97.  
  98. {Color, Brush, Font}
  99. Shape:
  100.     SetMenu()
  101.     UseBackground(TRANSPARENT,0,255,128)
  102.     DrawBackground
  103.     UseFont("Roman",0,20,BOLD,NOITALIC,NOUNDERLINE,64,0,0)
  104.     DrawText(76,5,"Oriel")
  105.     UseFont("Roman",0,20,BOLD,NOITALIC,NOUNDERLINE,255,0,0)
  106.     DrawText(75,5,"Oriel")
  107.     DrawBitmap(115,9,"ORIELIC4.BMP")
  108.     UseFont("Tms Rmn",0,12,BOLD,NOITALIC,NOUNDERLINE,0,0,0)
  109.     UseBackground(TRANSPARENT,0,255,128)
  110.     DrawText(20,25,"draws a variety of graphic images.")
  111.     DrawText(20,45,"As this demonstration shows, you can")
  112.     DrawText(20,57,"control the background color, the")
  113.     DrawText(20,69,"brush color and fill pattern, the")
  114.     DrawText(20,81,"line pattern and color, as well as")
  115.     DrawText(20,93,"the font style and color...")
  116.     WaitInput(6000)
  117.  
  118.     SetWaitMode(FOCUS)
  119.     Run("ORIEL COLBRFONT.ORL")
  120.     WaitInput(1)
  121.  
  122.     Goto Set_Text
  123.  
  124. {Flood an Area}
  125. Flood_Area:
  126.     UseBackground(OPAQUE,255,255,255)  {White background}
  127.     DrawBackground
  128.  
  129. {Set up the menu, mouse, and shapes}
  130. Flood_Menu:
  131.     Setmenu("&Brush Color",IGNORE,
  132.                   "&White",               Brush_White,
  133.                   "&Gray",                Brush_Gray,
  134.                   "&Red",                 Brush_Red,
  135.                   "&Yellow",              Brush_Yel,
  136.                   "Gree&n",               Brush_Grn,
  137.                   "&Light Blue",          Brush_Ltblu,
  138.                   "&Blue",                Brush_Blue,
  139.                   "&Pink",                Brush_Pink,
  140.                   "Blac&k",               Brush_Black,
  141.          ENDPOPUP,
  142.                  "&Exit!",                Flood_Bye,
  143.                  ENDPOPUP)
  144.         SetMouse(0,0,10000,10000,Mouse_Hit,Mouse_x,Mouse_y)
  145.     
  146. {Draw random shapes for flooding}
  147.         UseFont("System",0,0,BOLD,NOITALIC,NOUNDERLINE,0,0,0)
  148.         DrawText(5,5,"Click within an area to fill it with the selected color")
  149.     UseCoordinates(METRIC)
  150.     UseBrush(NULL,0,0,0)
  151.     UsePen(SOLID,3,0,0,0)
  152.     DrawRectangle(0,15,1000,1000)
  153.     DrawEllipse(10,20,90,100)
  154.     DrawEllipse(34,20,118,95)
  155.     DrawEllipse(30,30,150,150)
  156.     DrawEllipse(140,50,180,200)
  157.     DrawEllipse(90,110,130,300)
  158.     DrawRectangle(20,40,50,150)
  159.     DrawRectangle(70,20,180,150)
  160.     DrawRoundRectangle(80,70,120,120,10,10)
  161.  
  162.     UseCoordinates(PIXEL)
  163.     UseBrush(SOLID,255,0,0)           {Start with red brush}
  164.  
  165. Wait_for_hit:
  166.     WaitInput()
  167.  
  168. Mouse_Hit:
  169.     DrawFlood(Mouse_x,Mouse_y,0,0,0)
  170.     Goto Wait_for_Hit
  171.  
  172. Brush_White:
  173.     UseBrush(SOLID,255,255,255)
  174.     Goto Wait_for_Hit
  175.  
  176. Brush_Gray:
  177.     UseBrush(SOLID,192,192,192)
  178.     Goto Wait_for_Hit
  179.  
  180. Brush_Red:
  181.     UseBrush(SOLID,255,0,0)
  182.     Goto Wait_for_Hit
  183.  
  184. Brush_Yel:
  185.     UseBrush(SOLID,255,255,0)
  186.     Goto Wait_for_Hit
  187.  
  188. Brush_Grn:
  189.     UseBrush(SOLID,0,255,0)
  190.     Goto Wait_for_Hit
  191.  
  192. Brush_Ltblu:
  193.     UseBrush(SOLID,0,255,255)
  194.     Goto Wait_for_Hit
  195.  
  196. Brush_Blue:
  197.     UseBrush(SOLID,0,0,255)
  198.     Goto Wait_for_Hit
  199.  
  200. Brush_Pink:
  201.     UseBrush(SOLID,255,0,255)
  202.     Goto Wait_for_Hit
  203.  
  204. Brush_Black:
  205.     UseBrush(SOLID,0,0,0)
  206.     Goto Wait_for_Hit
  207.  
  208. Flood_Bye:
  209.     SetMouse()
  210.     SetKeyboard()
  211.     UseCoordinates(METRIC)
  212.     UseBrush(SOLID,255,255,255)
  213.      UsePen(SOLID,1,0,0,0)
  214.     Goto Set_Text
  215.  
  216. {Keyboard/Mouse Control}
  217. Mouse_Control:
  218.  
  219. {Initialize variables}
  220.     Set x1=10
  221.     Set x2=25
  222.     Set Red=127
  223.     Set Green=63
  224.     Set Blue=63
  225.     Set Rate=200
  226.     Set Display_secs=2
  227.  
  228.     SetMenu()
  229.     SetMouse()
  230.     UseBackground(TRANSPARENT,255,255,255)
  231.     DrawBackground
  232.  
  233.     UseBrush(SOLID,192,192,192)
  234.     UsePen(SOLID,1,0,0,0)
  235.     DrawRoundRectangle(88,50,114,60,2,2)
  236.     DrawRoundRectangle(88,100,114,110,2,2)
  237.     UseBrush(SOLID,255,255,255)
  238.     DrawRectangle(90,75,102,83)
  239.     UseFont("System",0,0,NOBOLD,NOITALIC,UNDERLINE,0,0,0)
  240.     DrawText(93,52,"F")
  241.     UseFont("System",0,0,NOBOLD,NOITALIC,NOUNDERLINE,0,0,0)
  242.     DrawText(96,52,"aster")
  243.     DrawNumber(92,76,Display_secs)
  244.     DrawText(103,76,"seconds")
  245.     UseFont("System",0,0,NOBOLD,NOITALIC,UNDERLINE,0,0,0)
  246.     DrawText(93,102,"S")
  247.     UseFont("System",0,0,NOBOLD,NOITALIC,NOUNDERLINE,0,0,0)
  248.     DrawText(96,102,"lower")
  249.     UseBackground(OPAQUE,255,255,255)
  250.     UsePen(NULL,1,0,0,0)
  251.  
  252. {Setup the menu, mouse, and keyboard}
  253.     SetMenu("&Exit!",Leave_it,
  254.         ENDPOPUP)
  255.     SetMouse(88,50,114,60,Faster,Temp,Temp,
  256.          88,100,114,110,Slower,Temp,Temp)
  257.     SetKeyboard("F",Faster,
  258.             "f",Faster,
  259.             "S",Slower,
  260.             "s",Slower)        
  261.  
  262. Wait:
  263.     WaitInput(Rate) 
  264. Past_Wait:
  265.     UseBrush(SOLID,Red,Green,Blue)
  266.     If x1>145 Then Set x1=10 | Set x2=25 | Goto Past_Wait
  267.     Set x1=x1+15
  268.     Set x2=x1+15
  269.     DrawRectangle(x1,10,x2,25)
  270.  
  271.     Set Red=Red+64
  272.     If Red<=255 Then Goto Wait
  273.     Set Red=63
  274.     Set Green=Green+64
  275.     If Green<=255 Then Goto Wait
  276.     Set Green=63
  277.     Set Blue=Blue+64
  278.     If Blue<=255 Then Goto Wait
  279.     Set Blue=63
  280.     Goto Wait
  281.  
  282. Faster:
  283.     If Display_secs = 1 Then Beep | Goto Wait
  284.     Set Display_secs=Display_secs-1
  285.     If Display_secs <> 9 Then Goto Draw_No
  286.     UseBrush(SOLID,255,255,255)
  287.     DrawRectangle(91,76,101,81)
  288.     Goto Draw_No
  289.  
  290. Slower:
  291.     If Display_secs = 10 Then Beep | Goto Wait
  292.     Set Display_secs=Display_secs+1
  293.  
  294. Draw_No:
  295.     DrawNumber(92,76,Display_secs)
  296.     Set Rate=Display_secs*100
  297.     Goto Wait
  298.  
  299. Leave_it:
  300.     UsePen(SOLID,1,0,0,0)
  301.     Goto Set_Text
  302.  
  303. {Messages}
  304. Msg:
  305.     SetMenu()
  306.     UseBackground(TRANSPARENT,255,0,255)
  307.     DrawBackground
  308.     UseFont("Roman",0,20,BOLD,NOITALIC,NOUNDERLINE,64,0,0)
  309.     DrawText(76,5,"Oriel")
  310.     UseFont("Roman",0,20,BOLD,NOITALIC,NOUNDERLINE,255,0,0)
  311.     DrawText(75,5,"Oriel")
  312.     DrawBitmap(115,9,"ORIELIC5.BMP")
  313.     UseFont("Tms Rmn",0,12,BOLD,NOITALIC,NOUNDERLINE,0,0,0)
  314.     DrawText(30,25,"allows you to create a variety")
  315.     DrawText(30,35,"of Windows message boxes...")
  316.     WaitInput(4000)
  317.  
  318.     MessageBox(OK,1,INFORMATION,"Oriel allows you to create informational messages, like this one...","F.Y.I.",null_var)
  319.     MessageBox(OK,1,EXCLAMATION,"Or you can be more emphatic about sharing information...","This is exciting!",null_var)
  320.  
  321.     MessageBox(OKCANCEL,1,STOP,"Sometimes, you may need to be the bearer of bad tidings...","You cannot do this!",Resp1)
  322.     If Resp1 = 2 Then MessageBox(OK,1,INFORMATION,"Although Oriel will permit you to cancel the program, we'll continue with our demonstration...","",Null_var)
  323.  
  324.     MessageBox(YESNOCANCEL,1,QUESTION,"And perhaps you may want to ask a question or two?","We await your response...",Resp2)
  325.     If Resp2 = 1 Then MessageBox(OK,1,EXCLAMATION,"So you can appreciate the value of Oriel!","Thanks for your response!",Null_var)
  326.     If Resp2 = 2 Then MessageBox(OK,1,EXCLAMATION,"But the ability to get user input is very, very important...","",Null_var)
  327.     If Resp2 = 3 Then MessageBox(OK,1,EXCLAMATION,"You've selected CANCEL, but we would like to continue with our demonstration anyway...","Cancel?",Null_var)
  328.  
  329.     Goto Set_Text
  330.  
  331. {Read Mouse Coordinates}
  332. Read_Mouse:
  333.     SetMenu()
  334.     UseBackground(TRANSPARENT,255,255,255)
  335.     DrawBackground
  336.  
  337. {Set up the mouse hit testing area and where to branch on a click}
  338.     SetMenu("&Exit!",Mouse_Kill,
  339.         ENDPOPUP)
  340.     SetMouse(0,0,1000,1000,Draw_Coord,Mouse_x,Mouse_y)
  341.     UseFont("System",0,0,BOLD,NOITALIC,NOUNDERLINE,0,0,0)
  342.     DrawText(5,5,"Click the mouse anywhere in the window to see the x,y coordinates")
  343.  
  344. Wait_Mouse:
  345.     WaitInput()
  346.  
  347. {Draw the x-coordinate}
  348. Draw_Coord:
  349.     DrawNumber(Mouse_x,Mouse_y,Mouse_x)
  350.  
  351. {Increase the x-coordinate by 3 millimeters for each digit in Mouse_x}
  352.     If Mouse_x>=100 Then Set x=Mouse_x+9 | Goto Draw_Comma {3 digits}
  353.     If Mouse_x>=10  Then Set x=Mouse_x+6 | Goto Draw_Comma {2 digits}
  354.     {Else}               Set x=Mouse_x+3               {1 digit only}
  355.  
  356. {Draw the comma}
  357. Draw_Comma:
  358.     DrawText(x,Mouse_y,",")
  359.  
  360. {Increase x by 2 and draw the y-coordinate}
  361.     Set x=x+2
  362.     DrawNumber(x,Mouse_y,Mouse_y)
  363.     Goto Wait_Mouse
  364.  
  365. Mouse_Kill:
  366.     SetMenu()
  367.     SetMouse()
  368.     Goto Set_Text
  369.  
  370. {Animation}
  371. Animate:
  372.     SetMenu()
  373.     UseBackground(TRANSPARENT,255,0,100)
  374.     DrawBackground
  375.  
  376. {Define coordinates of a rectangle}
  377.     Set upper_row=50
  378.     Set upper_col=0
  379.     Set lower_row=90
  380.     Set lower_col=30
  381.     Set upper_txt_col=8
  382.     Set times=0
  383.  
  384. {Print text in the window}
  385.     UseFont("System",0,0,NOBOLD,NOITALIC,NOUNDERLINE,0,0,255)
  386.     DrawText(10,20,"This is an example of how you can create simple")
  387.     DrawText(10,30,"animation with Oriel, the graphics-based batch")
  388.     DrawText(10,40,"language for Windows 3.0...")
  389.  
  390. Draw:
  391.     If times = 0 Then Goto Branch1
  392.     UseBrush(SOLID,255,0,100)    {Erase existing rectangle}
  393.     UsePen(NULL,1,255,0,100)
  394.     Set lower_row_temp=lower_row+1
  395.     DrawRectangle(upper_col,upper_row,lower_col,lower_row_temp)
  396.     Set upper_col=upper_col + 5
  397.     Set lower_col=lower_col + 5
  398.     Set upper_txt_col=upper_txt_col + 5
  399.  
  400. Branch1:
  401.     Set times=times + 1 
  402.     UseBrush(SOLID,0,255,255)        {Draw new rectangle}
  403.     UsePen(SOLID,1,255,0,100)
  404.     DrawRectangle(upper_col,upper_row,lower_col,lower_row)
  405.     DrawText(upper_txt_col,65,"Hello!")
  406.     WaitInput(100)
  407.     If upper_col <= 210 Then Goto Draw
  408.  
  409.     Goto Set_Text
  410.  
  411. {Re-initialize the menu, keyboard, and mouse}
  412. Menu_Init:
  413.     SetMenu()
  414.     SetMouse()
  415.     SetKeyboard()
  416.     Return
  417.  
  418. {Exit!}
  419. Bye:
  420.     End
  421.